package com.dahaiwuliang.code.dao;


import com.dahaiwuliang.code.pojo.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author bzd
 */
@Repository
public interface CommentDao extends JpaRepository<Comment,Integer>,JpaSpecificationExecutor<Comment> {


    @Transactional
    @Query (value = "delete  from comment where article_id =?1",nativeQuery = true)
    @Modifying
    void deleteByArticleId(Integer articleId);
}
